<html>
    <head>
        <title>UploadImage</title>
        <script type="text/javascript" src="/static/js/jquery-1.10.2.js"></script>	
    </head>
    <body>
        <div id="divUpload">
            <form id="imgForm" method="POST" action="/image/upload/" enctype="multipart/form-data">
                {% csrf_token %}
                {{imgform.security_hash}}
                {{imgform.timestamp}}
                {{imgform.honeypot}}
                {{imgform.userimage}}
            </form>
            <script type="text/javascript">
                $("#id_userimage").change(function(){ $("#imgForm").submit(); })
                {% if image %}
                parent.document.getElementById("imgPreview").innerHTML += '<image width=80 height=80 src="/static/{{image.path}}" />';
                parent.document.getElementById("hidevar").innerHTML += '<input type="hidden" name="imgid" value="{{image.id}}" />';
                {% endif %}
            </script>
        </div>
    </body>
</html>

